package com.zjy.service.impl;

import com.zjy.bean.GoodsCategory;
import com.zjy.dao.GoodsCategoryMapper;
import com.zjy.service.GoodsCategoryService;
import com.zjy.utils.UUIDUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Administrator on 2019/4/11.
 */
@Service
public class GoodsCategoryServiceImpl implements GoodsCategoryService{
    @Resource
    private GoodsCategoryMapper goodsCategoryMapper;

    @Override
    public int checkExistType(int type) {
        return goodsCategoryMapper.checkExistType(type);
    }

    @Override
    public void addGoodsCategory(GoodsCategory goodsCategory) {
        String id = UUIDUtils.getUUID();
        goodsCategory.setId(id);
        goodsCategoryMapper.insertSelective(goodsCategory);
    }

    @Override
    public int deleteGoodsCategoryById(String categoryId) {
        return goodsCategoryMapper.deleteGoodsCategoryById(categoryId);
    }

    @Override
    public int updateGoodsCategoryById(GoodsCategory goodsCategory) {
        return goodsCategoryMapper.updateByPrimaryKeySelective(goodsCategory);
    }

    @Override
    public GoodsCategory selectGoodsCategoryById(String categoryId) {
        return goodsCategoryMapper.selectGoodsCategoryById(categoryId);
    }

    @Override
    public List<GoodsCategory> selectAllGoodsCategory() {
        return goodsCategoryMapper.selectAllGoodsCategory();
    }
}
